<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="/js/axios.min.js"></script>
    <script src="/js/query.js"></script>
    <script>
        window.onload = function (){
           var errorInfo =  getQuery("errorInfo");
           if(errorInfo != null && errorInfo == "noland"){
               $("errorDiv").innerHTML = "请先登陆";
           }
        }

        function land(){
            axios.get("/user/login",{
                params:{
                    userName:$("userName").value,
                    pwd:$("pwd").value
                }
            }).then(resp =>{
                var info = resp.data;
                if(info == "ok"){
                    location.href = "/index.html";
                }
                else{
                    $("errorDiv").innerHTML = "登陆失败";
                }
            })
        }
    </script>
</head>
<body>
    <div id="errorDiv" style="color: red"></div>
    用户名：<input type="text" id="userName"><br>
    密码：<input type="password" id="pwd"><br>
    <input type="button" value="登陆" onclick="land()">

</body>
</html>